.\"
.\"	$OpenBSD: SSL_free.3,v 1.2 2014/12/02 14:11:01 jmc Exp $
.\"
.Dd $Mdocdate: December 2 2014 $
.Dt SSL_FREE 3
.Os
.Sh NAME
.Nm SSL_free
.Nd free an allocated SSL structure
.Sh SYNOPSIS
.In openssl/ssl.h
.Ft void
.Fn SSL_free "SSL *ssl"
.Sh DESCRIPTION
.Fn SSL_free
decrements the reference count of
.Fa ssl ,
and removes the
.Vt SSL
structure pointed to by
.Fa ssl
and frees up the allocated memory if the reference count has reached 0.
.Sh NOTES
.Fn SSL_free
also calls the
.Xr free 3 Ns
ing procedures for indirectly affected items, if applicable: the buffering
.Vt BIO ,
the read and write
.Vt BIOs ,
cipher lists specially created for this
.Fa ssl ,
the
.Sy SSL_SESSION .
Do not explicitly free these indirectly freed up items before or after calling
.Fn SSL_free ,
as trying to free things twice may lead to program failure.
.Pp
The
.Fa ssl
session has reference counts from two users: the
.Vt SSL
object, for which the reference count is removed by
.Fn SSL_free
and the internal session cache.
If the session is considered bad, because
.Xr SSL_shutdown 3
was not called for the connection and
.Xr SSL_set_shutdown 3
was not used to set the
.Vt SSL_SENT_SHUTDOWN
state, the session will also be removed from the session cache as required by
RFC2246.
.Sh RETURN VALUES
.Fn SSL_free
does not provide diagnostic information.
.Sh SEE ALSO
.Xr ssl 3 ,
.Xr SSL_clear 3 ,
.Xr SSL_new 3 ,
.Xr SSL_set_shutdown 3 ,
.Xr SSL_shutdown 3
